import request from '../../request'
import { AxiosResponse } from 'axios'
import { ResponseData } from '@/types/api/public'

type ConfigType<T=ResponseData> = Promise<AxiosResponse<T>>

/**
 * @desc: 获取
 */
export const getstrategy = (name:String,page:Number,size:Number): ConfigType => {
  return request({
    url: `/peng/getstrategy?name=${name}&page=${page}&size=${size}`,
    method: 'get',
  })
}

/**
 * @desc: 添加
 */
export const poststrategy = (data:any): ConfigType => {
    console.log(data);
    return request({
      url: '/peng/poststrategy',
      method: 'post',
      data
    })
  }

/**
 * @desc: 删除
 */
 export const delstrategy = (id:any): ConfigType => {
  return request({
    url: '/peng/delstrategy?_id='+id,
    method: 'get'
  })
}

/**
 * @desc: 添加
 */
export const putstrategy = (data:any): ConfigType => {
  console.log(data);
  return request({
    url: '/peng/putstrategy',
    method: 'post',
    data
  })
}